import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class CheckingAccountTest {
	CheckingAccount checking;
	CheckingAccount checking1;
	@Before
	public void setUp() throws Exception {
	}
	
	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void testCheckingAccountStringStringStringStringStringInt() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		assertTrue(checking.getAccountNumber() == 357950);
	}
	
	@Test
	public void testCheckingAccountStringStringStringStringStringFloatInt() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country",5000, 357950);
		assertTrue(checking.fAccountNumber == 357950);
		assertTrue(checking.fDebitAllowed);
		assertTrue(checking.getDebitAmount() == 5000);
	}
	
	@Test
	public void testDetermineCosts() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);	
		checking.determineCosts();
		assertTrue(checking.getBalance() == 49999);	
	}
	
	@Test
	public void testWithdrawal() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);	
		assertTrue(checking.withdrawal(49999));
		assertFalse(checking.withdrawal(49999));
		}
	
	@Test
	public void testGetBalance() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);
	}
	
	@Test
	public void testIncreaseBalance() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);
		checking.increaseBalance(1);
		assertTrue(checking.getBalance() == 50001);

	}
	
	@Test
	public void testDecreaseBalance() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);
		checking.decreaseBalance(50000);
		assertTrue(checking.getBalance() == 0);
	}
	
	@Test
	public void testGetDebitAmount() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country",5000, 357950);
		checking1 = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		assertTrue(checking.getDebitAmount() == 5000);
		assertTrue(checking1.getDebitAmount() == 0);
	}
	
	@Test
	public void testSetBalance() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking.setBalance(50000);
		assertTrue(checking.getBalance() == 50000);	
	}
	
	@Test
	public void testGetAccountNumber() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		assertTrue(checking.getAccountNumber() == 357950);
	}
	
	@Test
	public void testEqualsCheckingAccount() {
		checking = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		checking1 = new CheckingAccount("name", "street", "12587", "town", "country", 357950);
		assertTrue(checking.equals(checking1));
	}
	
}
